1. Field of the Invention
The present invention is related to the field of implementing object-oriented programming. Specifically, the present invention relates to the field of implementing object-oriented programming using an unmodified general-purpose programming language for a window-based system.
2. Art Background
There are many different views of what object-oriented programming is, but computer scientists and programmers agree on one thing: objects are components that combine the properties of procedure and data. All the action in object-oriented programming comes from sending events or messages between objects. Event sending is a form of indirect procedure call. The event specifies, among other things, the operation to be performed on an object. Objects respond to an event using their own procedures (called "methods") for performing operations. A set of events or messages defined as a uniform interface to objects is called a protocol. See, M. Stefik and D. G. Bobrow, "Object-Oriented Programming: Themes and Variations," The AI Magazine, Vol. 6, No. 4, Winter 1986, pp. 40-62. By object-oriented programming the present invention refers to data abstraction and inheritance. Data abstraction means that an object presents an interface to the application programmers through a set of methods. The manipulation of the internal data structures of the object and the implementation of these methods are completely transparent to the users of the object. Thus, the application programmer can change the underlying implementation of an objection without requiring the object users to change their procedure calls.
Inheritance means defining a new class as a variation of an existing class. A class is a tree structure describing one or more similar objects. As such, inheritance allows users to reuse existing software to build new software.
Many environments built using C are inherently object-oriented. A graphical user interface built on a window system is an example. However, C does not support object-oriented programming. See, L. Tesler, "Programming Experiences," Byte, August 1986.
Several approaches have been adapted to introduce object-oriented programming features to C. Some have explored the possibility of building modular design into C. See D. Kalyan, "Modular Programming in C: An Approach and Example," SIGPLAN Notices, Volume 20, No. 3, March 1985, pp. 9-15. The modular approach is based on static variables being placed in one file. Some approaches require a preprocessor such as objective-C. See, for example, S. Hook, Objective-C Reference Manual, Version 3.0, (Productivity Products International: December 1984). Yet other approaches attempt to define an entirely different language such as C++in implementing object-oriented programming. See, B. Stroustrup, The C++Programming Language, (Addison-Wesley: 1986).
The present invention implements object-oriented programming in C without modifying or extending the same. The object-oriented environment supported by the present invention includes X Window System Version 11 which supports the X11 protocol (see, R. W. Scheifler and J. Gettys, "The X Window System," ACM Transactions on Graphics, Volume 5, No. 2, April 1986, pp. 79-109) and the OPEN LOOK specification. OPEN LOOK provides a direct manipulation graphical interface into the UNIX system. (UNIX is a registered trademark of AT&T). For example, there is an application called filemanager that provides a visual interface into the UNIX file system giving files iconic representation. There are different iconic representations for executables, directories and data files. Using an input device such as a mouse, it is possible to click on a file and query its attributes or properties such as ownership and access rights. Under OPEN LOOK, it is also possible to double click on an iconic representation of the file and view it with an application. If the object is executable, then the program corresponding to the icon is run. See, "OPEN LOOK Graphical User Interface Functional Specification" (AT&T and Sun Microsystems, Inc.: 1988).
The X11 window system defines a distributed window protocol by which window servers and application processes communicate. A companion library called the X library provides a procedural interface to the protocol. An application causes procedure in the X library to send window management and drawing commands to the window server. The window server sends event notification to the application in response to user actions such as moving the mouse or typing on the keyboard and screened geometric changes. The window library queues events and packages them in a record structure. An application periodically polls the X library for the next event. See J. Gettys, R. Newman, R. W. Scheilfer, Xlib-C Language Interface, Massachusetts Institute of Technology, 1987. The X window system does not define any particular user interface style but provides a mechanism to support many interfaces. Although programmers can use X library to build applications, this library can be tedious and difficult to use correctly. Just handling the window manager conventions can require hundreds of lines of codes. The present invention is designed to be used with X window system and the X library to implement a user interface based on the OPEN LOOK specification. The present invention provides methods to partition data structures and procedures into various files. Furthermore, the present invention discloses methods to define new objects (instantiate the standard classes from part of the X library) to create user interface as part of the application rapidly.
The closest art known to the applicant is Xt Intrinsics Toolkit from Digital Electronic Corporation. See J. McCormack, P. Asente, "An Overview of the X Toolkit", Proceedings of the ACM SIGGRAPH Symposium on User Interface Software, October 1988, pp. 46-55, and J. McCormack, and P. Asente, "Using the X Toolkit, or How to Write a Widget", Proceedings of the the Summer, 1988 USENIX Conference, pp. 1-13. The present invention differs from from the Xt Intrinsics in the following ways: (1) the present invention has a uniform interface to all objects, while the Xt Intrinsics does not, (2) the present invention has chained event handlers while the Xt Intrinsics does not, and (3) the present invention defines its objects as comprising of attributes while the Xt Intrinsics defines its widgets as having resources. Although attributes and resources perform similar functions, i.e., referring to data elements within the object or widget, attributes do not necessarily refer to data elements within the object. Attributes of an object in the present invention could be a function call, for example, whereas a resource is by definition something that is inside of the widget, and (4) the present invention allows programmers to change the parent-child relationship while Xt Intrinsics does not.
It is therefore an object of the present invention to minimize the effort needed to write an X application by providing for a uniform user interface.
It is a further object of the present invention to provide a uniform interface to write an X application without modifying or extending the C language.
It is yet another object of the present invention to encourage user customization of X application through data abstraction.
It is yet another object of the present invention to allow users to reuse codes through inheritance.